import java.util.Scanner;

import jllowrey.model.DecisionLinesEvent;
import jllowrey.view.Application;


/**
 * Launching code that retrieves (m,n) from user keyboard input and then launches the window
 * in which the decisionLines are visible.
 *  
 * @author heineman
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// retrieve decision lines (N)
		int n = -1;
		while (n < 3 || n > 8) {
			System.out.println("Enter number of decision lines to use [3-8]: ");
			try { 
				n = Integer.valueOf(sc.nextLine());
			} catch (Exception e) {
				// announce error below
			}
			
			if (n < 3 || n > 8) {
				System.err.println("Please enter an integer between 3 and 8");
			}
		}
		
		// retrieve number of rounds (M)
		int m = -1;
		while (m < 3 || m > 8) {
			System.out.println("Enter number of rounds [3-8]: ");
			try { 
				m = Integer.valueOf(sc.nextLine());
			} catch (Exception e) {
				//
			}
			
			if (m < 3 || m > 8) {
				System.err.println("Please enter an integer between 3 and 8");
			}
		}
		
		DecisionLinesEvent decisionLinesEvent = new DecisionLinesEvent (n, m);
		Application app = new Application (decisionLinesEvent);
		app.setVisible (true);		
	}
}
